package com.sunfeng.chap4.test4;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

/**
 * @description:
 * @author: 孙 峰
 * @time: 2020/11/9 15:08
 */
public class Client {
    public static void main(String[] args) {

        try {
            System.out.println("socket begin " + System.currentTimeMillis());
            Socket socket = new Socket("127.0.0.1", 8088);
            System.out.println("socket end " + System.currentTimeMillis());
            Thread.sleep(3000);
            OutputStream outputStream = socket.getOutputStream();
            outputStream.write("我是大魔王".getBytes());
            outputStream.close();
            socket.close();
        } catch (IOException | InterruptedException e) {
            e.printStackTrace();
        }

    }
}
